<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="lushu">
		<title>异常交易确认</title>
		<script type="text/javascript" src="../script/common.js" language="JavaScript"></script>
		<script type="text/javascript" language="JavaScript">
			var ErrorType = [ErrorType.TAC_ERROR,
							ErrorType.CARDASN_ERROR,
							ErrorType.TRADETYPE_ERROR,
							ErrorType.PSAMASN_ERROR,
							ErrorType.ACCTYPE_ERROR,
							ErrorType.PSAM_NO_TMATCH,
							ErrorType.BALANCE_ERROR,
							//ErrorType.WRONG_BANK_ISSUER,
							ErrorType.TIME_ERROR,
							ErrorType.AMOUNT_EERROR]
			
			var Page;					//数据表格对象
			
			function initPageElements(){
				Page.sql = "error_trade_list";
				Eui.initDateInput("businessDateTd","业务日期",Page.form.id,"businessDate","_pastDate",false);
				Page.selection.tradeType = {list:Common.getItems("epstrade_type"),nullLabel:"全     部"};
				Page.selection.errorType = {list:Common.getSubsetItems("error_type",ErrorType),nullLabel:"全     部"};
				Page.selection.accountType = {list:Clear.AccountType.consume()};
				Page.operation = {title:"操作",
									width:"5%",
									align:"center",
									render:function(v,r){
												return "<a href=# onclick='editTrade("+r[0]+");'>明细</a>";
											}
								};
				Page.ppsTradeForm = $("ppsTradeForm");
				Common.initDict(Page.ppsTradeForm.tradeType,"epstrade_type");
				Common.initDict(Page.ppsTradeForm.errorCode,"error_type");
				Common.initDict(Page.ppsTradeForm.accountType,Clear.AccountType.consume());
				Common.initDict(Page.ppsTradeForm.adjustFlag,"adjust_type");
				$("tradeTimeTd").innerHTML = Eui.getDateInput("交易时间",Page.ppsTradeForm.name,"occurTime","dateTime",true,true);
			}
			
			function editTrade(id){
				if(!id)
					return;
				DWR.call("txQueryService.getPpsTrade",id,function(trade){
					Common.setValues(Page.ppsTradeForm,trade);
					Page.ppsTradeForm.amount.value = Format.fenToYuan(trade.amount)
					Page.ppsTradeForm.realAmount.value = Format.fenToYuan(trade.realAmount)
					Page.ppsTradeForm.cost.value = Format.fenToYuan(trade.cost)
					Page.ppsTradeForm.balance.value = Format.fenToYuan(trade.balance)
					Page.ppsTradeForm.adjustAmount.value = Format.fenToYuan(trade.adjustAmount)
					Page.ppsTradeForm.adjustRealAmount.value = Format.fenToYuan(trade.adjustRealAmount)
					Page.ppsTradeForm.recordTime.value = Format.timeRender(trade.recordTime)
					Page.ppsTradeForm.occurTime.value = Format.timeRender(trade.occurTime)
					switchPage("detailView");
				});
			}
			
			function confirmErrorTrade(){
				
  				var data = {}
				data = Common.getValues(ppsTradeForm);
				data.amount = Format.yuanToFen(Page.ppsTradeForm.amount.value)
				data.realAmount = Format.yuanToFen(Page.ppsTradeForm.realAmount.value)
				data.balance = Format.yuanToFen(Page.ppsTradeForm.balance.value)
				data.adjustAmount = Format.yuanToFen(Page.ppsTradeForm.adjustAmount.value)
				data.adjustRealAmount = Format.yuanToFen(Page.ppsTradeForm.adjustRealAmount.value)
				data.cost = Format.yuanToFen(Page.ppsTradeForm.cost.value)
				data.volumn = Page.ppsTradeForm.volumn.value * 100
				
				try{
					var result = DWR.syncCall("tradeService.confirmErrorTrade"
												,data
												,false
											)
					showInformation("交易确认成功")
					switchPage('listView')
					ListPage.showListTable()
				}catch(e){
					showError(e.description)
				}
			}
			
		</script>
	</head>
	<body onload="Clear.List.init()">
		<div class="nav"><div id="nav">&nbsp;</div></div>
	
		<div id="listView">
			<div class="searchForm">
				<form id="searchForm" name="searchForm">
					<table cellSpacing="0" cellPadding="4" width="100%" border="0">
						<tr>
							<td class="label5" id="acquirer"></td>
							<td class="label5" id="businessDateTd"></td>
							<td class="label5">
								<label>异常类型</label>
								<select name="errorType"><option></option></select>
							</td>
							</tr>
							<tr>
							<td  class="label5">
								<label>交易类型</label>
								<select name="tradeType"><option></option></select>
							</td>
							<td class="label5">
								<label>帐户类型</label>
								<select name="accountType" onchange="ListPage.changeAccountCode(this)"><option></select>
							</td>
							<td><button onclick="ListPage.showListTable()">查 询</button></td>
						</tr>
					</table>
				</form>
			</div>
			<div id="datalist"></div>
		</div>
		
		<div id="detailView" style="display:none;">
			<form id="ppsTradeForm" name="ppsTradeForm">
				<input name="id" readonly class='readonly' type="hidden">
				<div class="form" id="printArea">
					<div class="formTitle">异常交易明细</div>
					<table class='viewTable col2 label8' cellSpacing='0' cellPadding='4' width='100%' border='0'>
						<tr>
							<td><label>加油站编号</label> <input name="stationNo" readonly class='readonly' type="text"></td>
							<td><label>交易类型</label> <select name="tradeType" readonly class='disabled' disabled=true></select></td>
						</tr>
						<tr>
							<td><label>异常类型</label> <select name="errorCode" readonly class='disabled' disabled=true></select></td>
							<td><label>调整类型</label> <select name="adjustFlag" readonly class='disabled' disabled=true></select></td>
						</tr>
						<tr>
							<td><label>调整额</label> <input name="adjustAmount" type="text" readonly class='readonly'></td>
							<td><label>调整实际金额</label> <input name="adjustRealAmount" type="text" readonly class='readonly'></td>
						</tr>
						<tr>
							<td><label>银行卡号</label> <input name="bankCard" readonly class='readonly' type="text"></td>
							<td><label>银行流水号</label> <input name="bankTrace" readonly class='readonly' type="text"></td>
						</tr>
						<tr>
							<td><label>RPOS编号</label> <input name="rposNo" type="text" readonly class='readonly'></td>
							<td><label>RPOS流水号</label> <input name="rposSn" type="text" readonly class='readonly'></td>
						</tr>
						<tr>
							<td><label>EFT编号</label> <input name="eftNo" type="text" readonly class='readonly'></td>
							<td><label>EPS流水号</label> <input name="epsSn" type="text" readonly class='readonly'></td>
						</tr>
						<tr>
							<td><label>卡片交易序列号</label> <input name="offlineTxNo" type="text" readonly class='readonly'></td>
							<td><label>积分有效期</label> <input name="loyaltyDate" type="text" readonly class='readonly'></td>
						</tr>
						<tr>
							<td><label>油量</label> <input name="volumn" type="text" readonly class='readonly'></td>
							<td><label>销售明细</label> <input name="details" type="text" readonly class='readonly'></td>
						</tr>
						<tr>
							<td><label>入帐时间</label> <input name="recordTime" type="text" readonly class='readonly'></td>
							<td><label>业务日期</label> <input name="businessDate" type="text" readonly class='readonly'></td>
						</tr>
						<tr>
							<td><label>交&nbsp;易&nbsp;额</label> <input name="amount" type="text" readonly class='readonly'></td>
							<td><label>实际金额</label> <input name="realAmount" type="text" readonly class='readonly'></td>
						</tr>
						<tr>
							<td><label>成本金额</label> <input name="cost" type="text" readonly class='readonly'></td>
							<td><label>帐户类型</label> <select name="accountType" readonly class='disabled' disabled=true></select></td>
						</tr>
						<tr>
							<td><label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> <input name="cardAsn" type="text"></td>
							<td><label>帐户余额</label> <input name="balance" type="text"></td>
						</tr>
						<tr>
							<td id="tradeTimeTd"></td>
							<td><label>接入银行</label> <input name="bankNo" type="text"></td>
						</tr>
						<tr>
							<td><label>GMAC</label> <input name="gmac" type="text"></td>
							<td><label>TAC</label> <input name="tac" type="text"></td>
						</tr>
						<tr>
							<td><label>PSAM卡终端号</label> <input name="psamAsn" type="text"></td>
							<td><label>PSAM卡流水号</label> <input name="psamTraceNo" type="text"></td>
						</tr>
						
					</table>
				</div>
			</form>
			<p>
				<button onclick="confirmErrorTrade()">确 认</button>
				<button onclick="switchPage('listView')">返 回</button>
			</p>
		</div>
	</body>
</html>